package io.renren.modules.business.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.modules.business.entity.EAttendanceEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.business.dao.EAttendanceDao;
import io.renren.modules.business.service.EAttendanceService;


@Service("eAttendanceService")
public class EAttendanceServiceImpl extends ServiceImpl<EAttendanceDao, EAttendanceEntity> implements EAttendanceService {

    @Autowired
    private EAttendanceDao eAttendanceDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<EAttendanceEntity> page = this.page(
                new Query<EAttendanceEntity>().getPage(params),
                new QueryWrapper<EAttendanceEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public IPage<List<Map>> queryAttendanceList(Integer pageNum, Integer pageSize, Long userId, Long departmentId, Date clockTime) {
        Page page = new Page<>(pageNum, pageSize);
        return eAttendanceDao.queryAttendanceList(page, userId, departmentId, clockTime);
    }

}